{template '_header'}

<div class="page-heading">
    <span class='pull-right'>
        <a class='btn btn-primary btn-sm' href="{php echo webUrl('mc/merchant/add')}"><i class="fa fa-plus"></i> 添加多商户</a>
	</span>
    <h2>多商户管理 <small>总数: <span class='text-danger'>{$total}</span></small></h2> </div>
<form action="./index.php" method="get" class="form-horizontal" role="form" id="form1">
    <input type="hidden" name="c" value="site" />
    <input type="hidden" name="a" value="entry" />
    <input type="hidden" name="m" value="ewei_shopv2" />
    <input type="hidden" name="do" value="web" />
    <input type="hidden" name="r" value="merchant.agent" />

    <div class="page-toolbar row m-b-sm m-t-sm">
        <div class="col-sm-4">

            <div class="input-group-btn">
                <button class="btn btn-default btn-sm"  type="button" data-toggle='refresh'><i class='fa fa-refresh'></i></button>
                {ifp 'mc.agent.edit'}
                <div class="btn-group btn-group-sm">
                    <button data-toggle="dropdown" class="btn btn-default">黑名单 <span class="caret"></span>
                    </button>
                    <ul class="dropdown-menu">
                        <li><a class='btn' data-toggle='batch' data-href="{php echo webUrl('mc/agent/agentblack',array('agentblack'=>1))}" data-confirm='确认要设置黑名单?'>设置黑名单</a></li>
                        <li><a class='btn'  data-toggle='batch' data-href="{php echo webUrl('mc/agent/agentblack',array('agentblack'=>0))}" data-confirm='确认要取消黑名单?'>取消黑名单</a></li>
                    </ul>
                </div>

                <div class="btn-group btn-group-sm">
                    <button data-toggle="dropdown" class="btn btn-default">审核 <span class="caret"></span>
                    </button>
                    <ul class="dropdown-menu">
                        <li><a class='btn'  data-toggle='batch' data-href="{php echo webUrl('mc/agent/check',array('status'=>1))}"  data-confirm='确认要审核通过?'>审核通过</a></li>
                        <li><a class='btn'  data-toggle='batch' data-href="{php echo webUrl('mc/agent/check',array('status'=>0))}" data-confirm='确认要取消审核?'>取消审核</a></li>
                    </ul>
                </div>

                {/if}


                {ifp 'mc.agent.delete'}
                <button class="btn btn-default btn-sm" type="button" data-toggle='batch-remove' data-confirm="确认要删除?" data-href="{php echo webUrl('mc/agent/delete')}"><i class='fa fa-trash'></i> 删除</button>
                {/if}
            </div>
        </div>


        <div class="col-sm-7 pull-right">

            <select name='status' class='form-control  input-sm select-md' style="width:100px;"  >
                <option value=''>状态</option>
                <option value='0' {if $_GPC['status']=='0'}selected{/if}>未审核</option>
                <option value='1' {if $_GPC['status']=='1'}selected{/if}>已审核</option>
            </select>
            <select name='searchfield'  class='form-control  input-sm select-sm'   style="width:100px;"  >

                <option value='member' {if $_GPC['searchfield']=='member'}selected{/if}>分销商</option>
                <option value='parent' {if $_GPC['searchfield']=='parent'}selected{/if}>推荐人</option>

            </select>
            <div class="input-group">
                <input type="text" class="form-control input-sm"  name="keyword" value="{$_GPC['keyword']}" placeholder="昵称/姓名/手机号"/>
				 <span class="input-group-btn">

                                        <button class="btn btn-sm btn-primary" type="submit"> 搜索</button>
				</span>
            </div>

        </div>
    </div>
</form>
{if count($list)>0}

<table class="table table-hover table-responsive">
    <thead class="navbar-inner" >
    <tr>
        <th style="width:25px;"><input type='checkbox' /></th>

        <th style='width:100px;'>粉丝</th>
        <th style='width:110px;'>姓名<br/>手机号码</th>
        <th style='width:80px;'>等级</th>
        <th style='width:80px;'>累计佣金<br/>打款佣金</th>
        <th style='width:80px;'>下级分销商</th>

        <th style='width:90px;'>注册时间</th>
        <th style='width:90px;'>审核时间</th>
        <th style='width:70px;'>状态</th>
        <th style='width:70px;'>关注</th>
        <th style='width:70px;'>操作</th>
    </tr>
    </thead>
    <tbody>
    {loop $list $row}
    <tr rel="pop" data-title="ID: {$row['id']} ">

        <td>
            <input type='checkbox'   value="{$row['id']}"/>
        </td>

        <td >
            <span data-toggle='tooltip' title='{$row['nickname']}'>
            {if !empty($row['avatar'])}
            <img src='{$row['avatar']}' style='width:30px;height:30px;padding1px;border:1px solid #ccc' />
            {/if}
            {if empty($row['nickname'])}未更新{else}{$row['nickname']}{/if}
            </span>
        </td>

        <td>{$row['realname']} <br/> {$row['mobile']}</td>
        <td>{if empty($row['levelname'])} {php echo empty($this->set['levelname'])?'普通等级':$this->set['levelname']}{else}{$row['levelname']}{/if}</td>

        <td>{$row['mc_total']}<br/>{$row['mc_pay']}</td>
        <td >
            {$row['levelcount']}
            {if $row['levelcount']>0}
            <a data-toggle='popover' data-placement='bottom' data-content='{if $level>=1 && $row['level1']>0}一级：{$row['level1']} 人{/if}{if $level>=2  && $row['level2']>0}<br/> 二级：{$row['level2']} 人{/if}{if $level>=3  && $row['level3']>0}<br/>三级：{$row['level3']} 人{/if}'>
            <i class='fa fa-question-circle'></i>
            </a>
            {/if}

        </td>
        <td>{php echo date('Y-m-d',$row['createtime'])}<br/>{php echo date('H:i',$row['createtime'])}</td>
        <td>{if !empty($row['agenttime'])}
            {php echo date('Y-m-d',$row['agenttime'])}<br/>{php echo date('H:i',$row['agenttime'])}
            {else}
            -
            {/if}
        </td>
        <td>


            <span class='label {if $row['status']==1}label-success{else}label-default{/if}'
            {ifp 'mc.agent.check'}
            data-toggle='ajaxSwitch'
            data-confirm ='确认要{if $row['status']==1}取消审核{else}审核通过{/if}?'
            data-switch-value='{$row['status']}'
            data-switch-value0='0|未审核|label label-default|{php echo webUrl('mc/agent/check',array('status'=>1,'id'=>$row['id']))}'
            data-switch-value1='1|已审核|label label-success|{php echo webUrl('mc/agent/check',array('status'=>0,'id'=>$row['id']))}'
            {/if}
            >
            {if $row['status']==1}已审核{else}未审核{/if}</span>
            <br/>


            <span class='label {if $row['agentblack']==0}label-success{else}label-default{/if}'
            {ifp 'mc.agent.agentblack'}
            data-toggle='ajaxSwitch'
            data-confirm ='确认要{if $row['agentblack']==1}取消黑名单{else}设置黑名单{/if}?'
            data-switch-value='{$row['agentblack']}'
            data-switch-value0='0|正常|label label-success|{php echo webUrl('mc/agent/agentblack',array('agentblack'=>1,'id'=>$row['id']))}'
            data-switch-value1='1|黑名单|label label-default|{php echo webUrl('mc/agent/agentblack',array('agentblack'=>0,'id'=>$row['id']))}'
            {/if}
            >
            {if $row['agentblack']==1}黑名单{else}正常{/if}</span>
        </td>
        <td>
            {if empty($row['followed'])}
            {if empty($row['uid'])}
            <label class='label label-default'>未关注</label>
            {else}
            <label class='label label-warning'>取消关注</label>
            {/if}
            {else}
            <label class='label label-primary'>已关注</label>
            {/if}




        </td>


        <td  style="overflow:visible;">

            <div class="btn-group btn-group-sm">
                <a class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false" href="javascript:;">操作 <span class="caret"></span></a>
                <ul class="dropdown-menu dropdown-menu-left">
                    {ifp 'member.member.view'}<li><a href="{php echo webUrl('member/list/detail',array('id' => $row['id']));}" title='会员信息' target='_blank'><i class='fa fa-user'></i> 会员信息</a></li>	{/if}
                    <li class='divider'></li>
                    {ifp 'member.member.delete'}<li><a  data-toggle='ajaxRemove'  href="{php echo webUrl('member/delete',array('id' => $row['id']));}" title='删除会员' data-confirm="确定要删除该会员吗？"><i class='fa fa-remove'></i> 删除会员</a></li>{/if}

                </ul>
            </div>


        </td>
    </tr>
    {/loop}
    </tbody>
</table>
{$pager}

{else}
<div class='panel panel-default'>
    <div class='panel-body' style='text-align: center;padding:30px;'>
        暂时没有任何多商户!
    </div>
</div>
{/if}
<script language="javascript">


</script>

{template '_footer'}